package com.paperobot.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.paperobot.dao.AdminDao;
import com.paperobot.dao.BaseDao;
import com.paperobot.model.Admin;

@Repository("adminDao")
public class AdminDaoImpl extends BaseDao implements AdminDao{

	public Long addAdmin(Admin admin) throws Exception {
		Object obj=	saveObject("addAdmin", admin);
		if(null!=obj){
			return (Long)obj;
		}
		return -1L;
	}

	public Admin getAdmin(String userName) throws Exception {
		return (Admin) getObject("getAdmin", userName);
	}

	@SuppressWarnings("unchecked")
	public List<Admin> getAdminList(Map<String, Object> map) throws Exception {
		return (List<Admin>) getObjects("getAdminList", map);
	}

	public int updateAdmin(Admin admin) throws Exception {
		return updateObject("updateAdmin", admin);
	}

	public int deleteAdmin(Long adminId) throws Exception {
		return deleteObject("deleteAdmin", adminId);
	}

}
